﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using UnrealConverterLogic;
namespace Unreal_Unit_Converter_3
{
    public partial class formMainConverter : Form
    {
        private bool bExpanded = false;
        public formMainConverter()
        {
            InitializeComponent();
        }

        private void Form1_Load(object sender, EventArgs e)
        {
            this.Height = 105;
            this.KeyPreview = true;
            this.FormClosing += new FormClosingEventHandler(UnrealConverter.WriteOutXML);
            SetStyle(ControlStyles.SupportsTransparentBackColor, true);

            radioButton1.TabStop = false;
            radioButton2.TabStop = false;

            UnrealConverter.AddFormReference(this);
            UnrealConverter.SetListenersForConversion();

            UnrealConverter.formMainPosition = this.Location;
            UnrealConverter.formMainSize = this.Size;
            UnrealConverter.InitDataContainers();
            UnrealConverter.ReadXML(null, null);
            UnrealConverter.UpdateRatios();
            UnrealConverter.UpdateScaleIncrease();
            UnrealConverter.InitializeMainInputs();
        }
        private void GetHotKeys(object sender, KeyEventArgs e)
        {
            if (e.Control && e.KeyCode.ToString() == "A")
            {
                this.KeyPreview = false;
            }
            if (e.Control && e.KeyCode.ToString() == "X")
            {
                this.KeyPreview = false;
            }
            if (e.Control && e.KeyCode.ToString() == "C")
            {
                this.KeyPreview = false;
            }
            if (e.Control && e.KeyCode.ToString() == "V")
            {
                this.KeyPreview = false;
            }
        }
        private void btnExpandOptions_Click(object sender, EventArgs e)
        {
            if (!bExpanded)
            {
                this.Size = new Size(this.Size.Width, 427);
                ((Button)sender).Text = "/\\";
            }
            else
            {
                this.Size = new Size(this.Size.Width, 105);
                ((Button)sender).Text = "\\/";
            }
            bExpanded = !bExpanded;
        }
    }
}
